<template>
  <!--基本信息  -->
  <div style="height:720px">
    <FormPanel
      ref="infoBase"
      :list="initForm"
      :cols="3"
      :formType="value.type"
      :labelWidth="140"
      :isSubmitBtn="false"
      @formChange="formChangeHandle"
    />
  </div>
</template>

<script>
import { dictionary } from '@/utils/dictMixin';
export default {
  mixins: [dictionary],
  props: {
    value: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      initForm: this.initFormFun(),
      formValue: {}
    };
  },
  mounted() {
    console.log(this.value); //获取到行id 、类型（新增、详情）
    //请求接口进行赋值，自己写吧
  },
  methods: {
    //初始化数据
    init(data) {
      this.formValue = {};
      if (data.type === 'edit') {
        this.initForm.forEach(x => {
          x.initialValue = data.row[x.fieldName];
        });
      }
    },
    //搜索数据
    initFormFun() {
      return [
        {
          type: 'INPUT',
          label: '品牌',
          fieldName: 'field1',
          disabled: true,
          initialValue: ''
        },
        {
          type: 'INPUT',
          label: '经销商简称',
          fieldName: 'field2',
          placeholder: '请输入',
          initialValue: '',
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'blur'
            }
          ]
        },
        {
          type: 'INPUT',
          label: '经销商代码',
          fieldName: 'field3',
          disabled: true,
          initialValue: ''
        },
        {
          type: 'TEXT_AREA',
          label: '公司全称',
          fieldName: 'field4',
          rows: 2,
          initialValue: '',
          placeholder: '请输入',
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'blur'
            }
          ]
        },
        {
          type: 'SELECT',
          label: '经销商级别',
          fieldName: 'field6',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1008'),
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'change'
            }
          ]
        },
        {
          type: 'SELECT',
          label: '经销商类型',
          fieldName: 'field5',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1008'),
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'change'
            }
          ]
        },
        {
          type: 'SELECT',
          label: '细分类别',
          fieldName: 'field5',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1008')
        },
        {
          type: 'SELECT',
          label: '建设类型',
          fieldName: 'field7',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1008')
        },
        {
          type: 'SELECT',
          label: '事业部',
          fieldName: 'field8',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1008'),
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'change'
            }
          ]
        },
        {
          type: 'SELECT',
          label: '办事处',
          fieldName: 'field9',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1008'),
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'change'
            }
          ]
        },
        {
          type: 'SELECT',
          label: '启用标记',
          fieldName: 'field91',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1008'),
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'change'
            }
          ]
        },
        {
          type: 'SELECT',
          label: '省份',
          fieldName: 'field10',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1008'),
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'change'
            }
          ]
        },
        {
          type: 'SELECT',
          label: '城市',
          fieldName: 'field11',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1008'),
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'change'
            }
          ]
        },
        {
          type: 'SELECT',
          label: '县区',
          fieldName: 'field12',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1008'),
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'change'
            }
          ]
        },
        {
          type: 'SELECT',
          label: '经营状态',
          fieldName: 'field110',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1008'),
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'change'
            }
          ]
        },
        {
          type: 'SELECT',
          label: '是否启用中央补贴',
          fieldName: 'field111',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1008'),
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'change'
            }
          ]
        },
        {
          type: 'SELECT',
          label: '是否启用地方补贴',
          fieldName: 'field112',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1008'),
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'change'
            }
          ]
        },
        {
          type: 'SELECT',
          label: '系统管理员',
          fieldName: 'field113',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1008'),
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'change'
            }
          ]
        },
        {
          type: 'INPUT',
          label: '管理员电话',
          fieldName: 'field13',
          initialValue: '',
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'blur'
            }
          ]
        },
        {
          type: 'SELECT',
          label: '开票是否包含地方补贴',
          fieldName: 'field114',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1008'),
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'change'
            }
          ]
        },
        {
          type: 'INPUT',
          label: '保证金金额',
          fieldName: 'field14',
          initialValue: '',
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'blur'
            }
          ]
        },
        {
          type: 'SELECT',
          label: '体系内品牌',
          fieldName: 'field114',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1008')
        },
        {
          type: 'INPUT',
          label: '设计费金额',
          fieldName: 'field16',
          initialValue: '',
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'blur'
            }
          ]
        },
        {
          type: 'SELECT',
          label: '建店标准',
          fieldName: 'field121',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1008'),
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'change'
            }
          ]
        },
        {
          type: 'INPUT',
          label: '补贴金额',
          fieldName: 'field17',
          initialValue: ''
        },
        {
          type: 'SELECT',
          label: '建店级别',
          fieldName: 'field18',
          placeholder: '请选择',
          initialValue: '',
          itemList: this.createDictList('1008'),
          rules: [
            {
              required: true,
              message: '必填',
              trigger: 'change'
            }
          ]
        },{
          type: 'TEXT_AREA',
          label: '其他',
          rows:2,
          maxlength:100,
          fieldName: 'field19',
          initialValue: ''
        },{
          type: 'UPLOAD_IMG',
          label: '设计费附件',
          fieldName: 'field160',
          upload: {
            actionUrl: '', //上传的地址
            fixedSize: [300, 500], //剪裁尺寸
            isCalcHeight: false,
            limit: 1 //上传数量
          },
          initialValue: ''
        },
        {
          type: 'UPLOAD_IMG',
          label: '保证金附件',
          fieldName: 'field15',
          upload: {
            actionUrl: '', //上传的地址
            fixedSize: [300, 500], //剪裁尺寸
            isCalcHeight: false,
            limit: 1 //上传数量
          },
          initialValue: ''
        }
      ];
    },
    formChangeHandle(val) {
      this.formValue = val;
    }
  }
};
</script>